<!-- 管理员:课程考核管理-考试计划管理-开始排考 -->
<template>
  <div class="assessment-container" style="width:100% !important;">
    <div>
      <el-form :model="queryParamsForm" class="formSearch" v-if="roleId == '1490859421955674114'">
        <div style="height: 32px;margin-bottom: 10px;">
          <el-form-item label="日期" prop="exadate">
            <el-date-picker type="date" clearable value-format="yyyy-MM-dd"
            format="yyyy-MM-dd" placeholder="请选择日期" v-model="queryParamsForm.exadate" style="width: 140px;" size="mini"></el-date-picker>
          </el-form-item>
          <el-form-item label="节　　次" prop="exaschedule">
            <el-select
              v-model="queryParamsForm.exaschedule" size="mini"
              placeholder="请选择节次"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="item in sectionList"
                :key="item.dictKey"
                :label="item.dictValue"
                :value="item.dictKey"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="课程负责单位" prop="department">
            <el-select
              v-model="queryParamsForm.department"
              style="width: 140px;margin-right:5px"
              size="mini"
              placeholder="请选择"
              @change="handleXb"
              clearable
            >
              <el-option
              style="margin-right:5px"
                v-for="(item,index) in xbList"
                :key="index"
                :label="item.deptName"
                :value="item.deptName"
              >
              </el-option>
            </el-select>
            <el-select
              v-model="queryParamsForm.teachingandresearchsection"
              style="width: 140px"
              size="mini"
              placeholder="请选择"
              @change="handleClass"
              clearable
            >
              <el-option
                v-for="(item,index) in gClassList"
                :key="index"
                :label="item.deptName ? item.deptName : item.value"
                :value="item.deptName ? item.deptName : item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="课程名称" prop="coursename">
            <el-input v-model="queryParamsForm.coursename" clearable size="mini" style="width:140px" placeholder="请输入课程名称"></el-input>
          </el-form-item>
          <el-form-item label="教员名称" prop="teachingfaculty">
            <el-input v-model="queryParamsForm.teachingfaculty" clearable size="mini" style="width:140px" placeholder="请输入教员名称"></el-input>
          </el-form-item>
          <el-form-item label="队别" prop="studentteam">
            <el-select
              v-model="queryParamsForm.studentteam" 
              size="mini"
              placeholder="请选择队别"
              style="width: 140px"
              clearable
            >
              <el-option
                v-for="item in ddList"
                :key="item.id"
                :label="item.deptName"
                :value="item.deptName"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </div>
        <div style="height: 32px">
          <el-form-item label="级次" prop="studentlevel">
            <el-select
              v-model="queryParamsForm.studentlevel" size="mini"
              placeholder="请选择级次"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="(item,index) in njList"
                :key="index"
                :label="item.xqszxn"
                :value="item.xqszxn"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="专业班次" prop="className">
            <el-select
              v-model="queryParamsForm.className" size="mini"
              placeholder="请选择专业班次"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="(item) in specialtyList"
                :key="item.id"
                :label="item.className"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="人数" prop="biggernumber">
            <el-input v-model="queryParamsForm.biggernumber" size="mini" style="width:120px" type="number" placeholder="请输入人数"></el-input><span style="margin-left:5px;color:#004ca7">人</span>
          </el-form-item>
          <el-form-item label="状态" prop="examcoucheckstatus">
            <el-select
              v-model="exaStatus" 
              size="mini"
              placeholder="请选择状态"
              style="width:175px"
              value-key="value"
              clearable
              multiple
              collapse-tags
            >
              <el-option
                v-for="item in statusList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <div class="search-button" style="margin:2px 0 0 0;color: #51aef6; display: inline-flex;;
              flex-direction: row;
              align-items: center;
              justify-content: center;
              position: relative;
              top: 4px;"
              @click="onSearchClickHandler">
              <img src="../../../assets/assessment/icon-search.png" alt="" />
              <span>查询</span>
            </div>
          </el-form-item>
          <!-- <div style="text-align:center">
          <el-button icon="el-icon-search" type="primary" @click="onSearchClickHandler" size="mini">查询</el-button>
          </div> -->
        </div>
      </el-form>
      <el-form :model="queryParamsForm" class="formSearch" v-if="roleId == '1490880658945843202'">
        <div style="height: 32px;margin-bottom: 10px;">
          <el-form-item label="学期" prop="exaschedule" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.xueqi" size="mini"
              placeholder="请选择学期"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="(item,index) in xqList"
                :key="index"
                :label="item.xqmc"
                :value="item.xqmc"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="考试类型" prop="exaschedule" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.checkType" 
              size="mini"
              placeholder="请选择考试类型"
              style="width: 140px"
              clearable
            >
              <el-option
                v-for="(item,index) in checkTypeList"
                :key="index"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="批　　次" prop="exaschedule" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.planname" 
              size="mini"
              placeholder="请选择批次"
              style="width: 160px"
              clearable
            >
              <el-option
                v-for="(item,index) in selectPcList"
                :key="index"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="日期" prop="exadate" style="margin-right: 32px;">
            <el-date-picker type="date" clearable value-format="yyyy-MM-dd"
            format="yyyy-MM-dd" placeholder="请选择日期" v-model="queryParamsForm.exadate" style="width: 140px;" size="mini"></el-date-picker>
          </el-form-item>
          <el-form-item label="节次" prop="exaschedule" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.exaschedule" size="mini"
              placeholder="请选择节次"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="item in sectionList"
                :key="item.dictKey"
                :label="item.dictValue"
                :value="item.dictKey"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="队别" prop="studentteam" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.studentteam" 
              size="mini"
              placeholder="请选择队别"
              style="width: 140px"
              clearable
            >
              <el-option
                v-for="item in ddList"
                :key="item.id"
                :label="item.deptName"
                :value="item.deptName"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="级次" prop="studentlevel" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.studentlevel" size="mini"
              placeholder="请选择级次"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="(item,index) in njList"
                :key="index"
                :label="item.xqszxn"
                :value="item.xqszxn"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="专业班次" prop="className" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.className" size="mini"
              placeholder="请选择专业班次"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="(item) in specialtyList"
                :key="item.id"
                :label="item.className"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </div>
        <div style="height: 32px">
          <el-form-item label="人数" prop="biggernumber" style="margin-right: 32px;">
            <el-input v-model="queryParamsForm.biggernumber" size="mini" style="width:120px" type="number" placeholder="请输入人数"></el-input><span style="margin-left:5px;color:#004ca7">人</span>
          </el-form-item>
          <el-form-item label="课程名称" prop="coursename" style="margin-right: 32px;">
            <el-input v-model="queryParamsForm.coursename" clearable size="mini" style="width:140px" placeholder="请输入课程名称"></el-input>
          </el-form-item>
          <el-form-item label="教员名称" prop="teachingfaculty" style="margin-right: 32px;">
            <el-input v-model="queryParamsForm.teachingfaculty" clearable size="mini" style="width:140px" placeholder="请输入教员名称"></el-input>
          </el-form-item>
          <el-form-item label="状态" prop="examcoucheckstatus">
            <el-select
              v-model="exaStatus" 
              size="mini"
              placeholder="请选择状态"
              style="width:175px"
              value-key="value"
              clearable
              multiple
              collapse-tags
            >
              <el-option
                v-for="item in statusList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <div class="search-button" style="margin:2px 0 0 0;color: #51aef6; display: inline-flex;;
              flex-direction: row;
              align-items: center;
              justify-content: center;
              position: relative;
              top: 4px;"
              @click="onSearchClickHandler">
              <img src="../../../assets/assessment/icon-search.png" alt="" />
              <span>查询</span>
            </div>
          </el-form-item>
          <!-- <div style="text-align:center">
          <el-button icon="el-icon-search" type="primary" @click="onSearchClickHandler" size="mini">查询</el-button>
          </div> -->
        </div>
      </el-form>
      <el-form :model="queryParamsForm" class="formSearch" v-if="roleId == '1475294432243830786'">
        <div style="height: 32px;margin-bottom: 10px;">
          <el-form-item label="学期" prop="exaschedule" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.xueqi" size="mini"
              placeholder="请选择学期"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="(item,index) in xqList"
                :key="index"
                :label="item.xqmc"
                :value="item.xqmc"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="批　　次" prop="exaschedule" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.planname" 
              size="mini"
              placeholder="请选择批次"
              style="width: 160px"
              clearable
            >
              <el-option
                v-for="(item,index) in selectPcList"
                :key="index"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="考试类型" prop="exaschedule" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.checkType" 
              size="mini"
              placeholder="请选择考试类型"
              style="width: 140px"
              clearable
            >
              <el-option
                v-for="(item,index) in checkTypeList"
                :key="index"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="级次" prop="studentlevel" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.studentlevel" size="mini"
              placeholder="请选择级次"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="(item,index) in njList"
                :key="index"
                :label="item.xqszxn"
                :value="item.xqszxn"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="专业班次" prop="className" style="margin-right: 32px;">
            <el-select
              v-model="queryParamsForm.className" size="mini"
              placeholder="请选择专业班次"
              style="width:140px"
              clearable
            >
              <el-option
                v-for="(item) in specialtyList"
                :key="item.id"
                :label="item.className"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="课程名称" prop="coursename" style="margin-right: 32px;">
            <el-input v-model="queryParamsForm.coursename" clearable size="mini" style="width:140px" placeholder="请输入课程名称"></el-input>
          </el-form-item>
          <el-form-item label="状态" prop="examcoucheckstatus">
            <el-select
              v-model="exaStatus" 
              size="mini"
              placeholder="请选择状态"
              style="width:175px"
              clearable
              value-key="value"
              multiple
              collapse-tags
            >
              <el-option
                v-for="item in statusList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <div class="search-button" style="margin:2px 0 0 0;color: #51aef6; display: inline-flex;;
              flex-direction: row;
              align-items: center;
              justify-content: center;
              position: relative;
              top: 4px;"
              @click="onSearchClickHandler">
              <img src="../../../assets/assessment/icon-search.png" alt="" />
              <span>查询</span>
            </div>
          </el-form-item>
        </div>
      </el-form>
    </div>
     
    <div style="text-align:right;padding:0" v-if="roleId == '1490859421955674114'">
      <div class="search-button" style="width:120px;margin:2px 0 0 15px;border: 1px solid #f86900;
      color: #f86900;
      background: #fff6ef;padding-right: 15px;" @click="statistical">
        <span>考试数据统计</span>
      </div>
      <div class="search-button" style="width:120px;margin:2px 0 0 15px;border: 1px solid #5230e9;
      color: #5230e9;
      background: #efebff;padding-right: 15px;" @click="adjustInVi">
        <span>监考申请记录</span>
      </div>
      <div class="search-button" style="width:80px;margin:2px 0 0 15px;background: #fff6dc;
      border: 1px solid #f1b107;
      color: #f1b107;padding-right: 10px;" @click="isCanIssuePlan">
        <span>下发核对</span>
      </div>
      <div class="search-button" style="width:70px;margin:2px 0 0 15px;
      color: rgb(81, 174, 246);padding-right: 16px;" @click="issueBatch">
        <span>发 布</span>
      </div>
      <div class="search-button" style="width:80px;
      margin:2px 0 0 15px;
      background: #ffefef;
      border: 1px solid #fa5339;
      color: #ff3819;
      padding-right: 10px;" @click="stayIssueBatch">
        <span>取消发布</span>
      </div>
    </div>
    <div style="text-align:right;padding:0">
      <div class="search-button" style="width:120px;margin:2px 0 0 15px;border: 1px solid #5230e9;
      color: #5230e9;
      background: #efebff;padding-right: 15px;" @click="adjustInVi" v-if="roleId == '1490880658945843202' || roleId == '1475294432243830786'">
        <span>监考申请记录</span>
      </div>
      <div class="search-button" style="width:150px;margin:2px 0 0 15px;border: 1px solid #f86900;
      color: #f86900;
      background: #fff6ef;padding-right: 15px;" @click="toLinkAll" v-if="roleId == '1490880658945843202' || roleId == '1475294432243830786'">
        <span>查看全部考试安排</span>
      </div>
      <div class="search-button" style="width:150px;margin:2px 0 0 15px;background: #fff6dc;
      border: 1px solid #f1b107;
      color: #f1b107;padding-right: 15px;" @click="toLinkAllT" v-if="roleId == '1490880658945843202'">
        <span>查看全部缓考安排</span>
      </div>
    </div>
    <div>
      
    <el-table
      :data="tableData"
      max-height="650"
      :span-method="arraySpanMethod"
      class="xpaas-table-class"
      row-class-name="xpaas-row-class"
      cell-class-name="xpaas-cell-class"
      header-row-class-name="xpaas-header-row-class"
      header-cell-class-name="xpaas-header-cell-class"
      @selection-change="handleSelectionlssue"
    >
      <el-table-column type="selection" width="75" align="center" prop="checkBoxAll" v-if="roleId == '1490859421955674114' || roleId == '1490880658945843202'"></el-table-column>
      <el-table-column prop="examcoucheckstatus" label="状态/操作" align="center" width="150" v-if="roleId == '1490859421955674114'">
        <template slot-scope="scope">
          <div v-show="scope.row.examcoucheckstatus" :style="scope.row.examcoucheckstatus != '5' ? 'color:#fa5339' : 'color:#51aef6'">{{scope.row.examcoucheckstatus === '1' ? '待排考' : scope.row.examcoucheckstatus === '2' ? '待下发核对': scope.row.examcoucheckstatus === '6' ? '待教员审核' : scope.row.examcoucheckstatus === '3' ? '待教研主任审核' :scope.row.examcoucheckstatus === '4' ? '待发布' : '已发布'}}
          </div>
          <div class="bk-lucj-expot-button" @click="arrangeExam(scope.row.courseid)" style="background: #f1fff8;
            border: 1px solid #02c86c;margin-top:10px" v-show="scope.row.examcoucheckstatus < '5'">
            <img src="../../../assets/assessment/icon-plan-record-detail.png" alt="" />
            <span style="color: #02c86c;">安排考试</span>
          </div>
          <div class="bk-lucj-expot-button" @click="lookSpeeds(scope.row)" style="margin-top:10px">
            <img src="../../../assets/home/icon-function-query-results.png" alt="" />
            <span>排考进度</span>
          </div>
          <div class="search-button" @click="release(scope.row.courseid)" style="width:95px" v-show="scope.row.examcoucheckstatus == '4'">
            <img src="../../../assets/assessment/icon-pass.png" alt="" style="width:15px;height:15px;position:relative;top:3px" />
            <span>发&#12288;&#12288;布</span>
          </div>
          <div class="bk-lucj-expot-button" @click="stayIssueOne(scope.row.courseid)" style="background: #ffefef;
          border: 1px solid #fa5339;margin-top:10px" v-show="scope.row.examcoucheckstatus == '5'">
            <img src="../../../assets/assessment/icon-close.png" alt="" style="relative;top:3px" />
            <span style="color: #fa5339;">取消发布</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="examcoucheckstatus" label="状态/操作" align="center" width="150" v-if="roleId == '1490880658945843202'">
        <template slot-scope="scope">
          <div v-show="scope.row.examcoucheckstatus" :style="scope.row.examcoucheckstatus != '5' ? 'color:#fa5339' : 'color:#51aef6'">{{scope.row.examcoucheckstatus === '1' ? '待排考' : scope.row.examcoucheckstatus === '2' ? '待下发核对': scope.row.examcoucheckstatus === '6' ? '待教员审核' : scope.row.examcoucheckstatus === '3' ? '待教研主任审核' :scope.row.examcoucheckstatus === '4' ? '待发布' : '已发布'}}
          </div>
          <div class="bk-lucj-expot-button" @click="arrangeExam(scope.row.courseid)" style="background: #f1fff8;
            border: 1px solid #02c86c;margin-top:10px" v-show="scope.row.examcoucheckstatus != '5'">
            <img src="../../../assets/assessment/icon-plan-record-detail.png" alt="" />
            <span style="color: #02c86c;">安排考试</span>
          </div>
          <!-- <div class="bk-lucj-expot-button" @click="stayIssue(scope.row.courseid)" v-show="scope.row.examcoucheckstatus < '4'">
            <img src="../../../assets/home/icon-function-query-results.png" alt="" />
            <span>审核通过</span>
          </div> -->
          <div class="bk-lucj-expot-button" @click="stayIssueData(scope.row.courseid)" style="background: #f1f8fe;
          border: 1px solid #51aef6;margin-top:10px" v-show="scope.row.examcoucheckstatus < '4'">
            <img src="../../../assets/assessment/icon-finish.png" alt="" />
            <span style="color:#51aef6">审核通过</span>
          </div>
          <div class="bk-lucj-expot-button" @click="lookSpeeds(scope.row)" style="margin-top:10px">
            <img src="../../../assets/home/icon-function-query-results.png" alt="" />
            <span>排考进度</span>
          </div>
          <div class="bk-lucj-expot-button" @click="levelUpdate(scope.row)" style="background: #ffefef;
          border: 1px solid #fa5339;margin-top:10px" v-show="scope.row.examcoucheckstatus != '5'">
            <img src="../../../assets/assessment/icon-close.png" alt="" style="relative;top:3px" />
            <span style="color: #fa5339;">打　　回</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="examcoucheckstatus" label="状态" align="center" v-if="roleId == '1475294432243830786'">
        <template slot-scope="scope">
          <!-- <div class="bk-lucj-expot-button" @click="stayIssue(scope.row.courseid)" v-show="scope.row.examcoucheckstatus < '4'">
            <img src="../../../assets/home/icon-function-query-results.png" alt="" />
            <span>审核通过</span>
          </div>
          <div class="bk-lucj-expot-button" style="background: #f1f8fe;
          border: 1px solid #51aef6;margin-top:10px" v-show="scope.row.examcoucheckstatus == '4'">
            <img src="../../../assets/assessment/icon-finish.png" alt="" />
            <span style="color:#51aef6">已通过</span>
          </div> -->
          <div v-show="scope.row.examcoucheckstatus" :style="scope.row.examcoucheckstatus != '5' ? 'color:#fa5339' : 'color:#51aef6'">{{scope.row.examcoucheckstatus === '1' ? '待排考' : scope.row.examcoucheckstatus === '2' ? '待下发核对': scope.row.examcoucheckstatus === '6' ? '待教员审核' : scope.row.examcoucheckstatus === '3' ? '待教研主任审核' :scope.row.examcoucheckstatus === '4' ? '待发布' : '已发布'}}
          </div>
          <div class="bk-lucj-expot-button" @click="lookSpeeds(scope.row)" style="margin-top:10px">
            <img src="../../../assets/home/icon-function-query-results.png" alt="" />
            <span>排考进度</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="exadate" label="日期" align="center"></el-table-column>
      <el-table-column prop="exaschedule" label="节次" align="center"></el-table-column>
      <el-table-column prop="department" label="系" align="center"></el-table-column>
      <el-table-column prop="teachingandresearchsection" label="教研室" align="center"></el-table-column>
      <el-table-column prop="coursename" label="考试课程" align="center"></el-table-column>
      <el-table-column prop="teachingfaculty" label="授课教员" align="center"></el-table-column>
      <el-table-column prop="checktype" label="考试类型" align="center" v-if="roleId == '1490880658945843202' || roleId == '1475294432243830786'"></el-table-column>
      <el-table-column prop="finalexamination" label="考试方式" align="center"></el-table-column>
      <el-table-column prop="situdemand" label="场地需求" align="center" v-if="roleId == '1490859421955674114'"></el-table-column>
      <!-- <el-table-column prop="studentTeam" label="队别" align="center">
        <template slot-scope="scope">
          <div v-for="item in scope.row.examplancalssList" key="index">
            <span>{{ item.specialtyClassInfo.studenteamname }}</span>
          </div>
        </template>
      </el-table-column> -->
      <el-table-column prop="studentTeam" label="队别" align="center"></el-table-column>
      <el-table-column prop="studentlevel" label="级次" align="center"></el-table-column>
      <el-table-column prop="className" label="专业班次" align="center" width="200">
        <!-- <template slot-scope="scope">
          <div v-if="scope.row.specialtyClassInfo.className.length >= 2">
            <div v-for="item in scope.row.className" key="index">
              <span>{{ item.name }}</span>
            </div>
          </div>
          <div v-else v-for="item in scope.row.className[0].name" key="index">
            <span>{{ item }}</span>
          </div>
        </template> -->
      </el-table-column>
      <el-table-column prop="biggernumber" label="人数" align="center"></el-table-column>
      <el-table-column prop="exasite" label="考场" align="center"></el-table-column>
      <el-table-column prop="exaterid" label="监考员" align="center" width="120">
        <template slot-scope="scope">
            <div v-if="scope.row.exatername.length > 0 && (typeof scope.row.exatername) == 'object'">
              <div v-for="(item) in scope.row.exatername" key="index" class="name-button">
                <span>{{ item }}</span>
              </div>
              <span @click="setTeacher('',scope.row)" style="color: #02c86c;margin-left:5px;
              cursor: pointer;
              position: absolute;
              top: 42%;
              left: 75%;" class="el-icon-edit"></span>
              <div class="bk-lucj-expot-button" @click="applyChange(scope.row)" style="
                border: 1px solid #5230e9;
                color: #5230e9;
                background: #efebff;margin-top: 10px;" v-if="roleId == '1475294432243830786'">
                <span style="color: #5230e9;">申请调整监考</span>
              </div>
            </div>
            <div v-if="scope.row.exatername && (typeof scope.row.exatername) == 'string'">
              <div class="name-button">
                <span>{{ scope.row.exatername }}</span>
                <span @click="setTeacher('',scope.row)" style="color: #02c86c;margin-left:5px;
                  cursor: pointer;
                  position: absolute;
                  line-height: 23px;
                  left: 75%;margin-left:10px" class="el-icon-edit">
                </span>
              </div>
              <div class="bk-lucj-expot-button" @click="applyChange(scope.row)" style="border: 1px solid #5230e9;
                color: #5230e9;
                background: #efebff;margin-top: 10px;" v-if="roleId == '1475294432243830786'">
                <span style="color: #5230e9;">申请调整监考</span>
              </div>
            </div>
            <div v-if="scope.row.exatername == ''">
              <div class="bk-lucj-expot-button" @click="setTeacher('',scope.row)" style="background: #f1fff8;
                border: 1px solid #02c86c">
                <span style="color: #02c86c;">设置监考员</span>
              </div>
            </div>
        </template>
      </el-table-column>
      <el-table-column prop="remark" label="备注" align="center">
        <template slot-scope="scope">
          <el-input
            v-model="scope.row.remark"
            class="detail-input"
            type="textarea"
            autosize
            @blur="saveRemarks(scope.row)"
          ></el-input>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog title="设置监考员" :visible.sync="showJKYDialog" width="983px" class="szjky">
        <div class="choose-ypr-container">
          <div class="choose-ypr-search-container">
            <span class="title">单位：</span>
            <el-select
              v-model="company"
              style="width: 150px; margin-right: 30px"
              size="mini"
              clearable
              placeholder="请选择"
            >
              <el-option
                v-for="(item,index) in companyList"
                :key="index"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
            <el-input
              style="width: 152px; margin-right: 20px"
              size="mini"
              v-model="courseYpr"
              clearable
              placeholder="关键字搜索"
            >
              <i slot="prefix" class="el-input__icon el-icon-search"></i>
            </el-input>
            <div class="search-button" style="display: inline-flex;position: relative;top: 2px;" @click="searchTeacher">
              <img src="../../../assets/assessment/icon-search.png" alt="" />
              <span style="color:#51aef6">查询</span>
            </div>
            <!-- <div class="button-list">
              <el-tag
                class="button-item"
                v-for="(tag,index) in searchNameList"
                :key="index"
                closable
                type="info">
                {{tag.name}}
              </el-tag>
            </div> -->
            <!-- <div class="button-list">
              <div
                class="button-item"
                v-for="(item,index) in searchNameList"
                :key="index"
                @click="delTag(index)"
              >
                <img
                  class="del-icon"
                  src="../../../assets/assessment/approval-del.png"
                  alt=""
                />
                <div>{{ item.name }}</div>
              </div>
            </div> -->
          </div>
          <div class="choose-ypr-table-container">
            <el-table
              :data="yprList"
              max-height="350"
              ref="multipleTableExter"
              style="width: 100%;margin-top:15px"
              class="xpaas-table-class"
              row-class-name="xpaas-row-class"
              cell-class-name="xpaas-cell-class"
              header-row-class-name="xpaas-header-row-class"
              header-cell-class-name="xpaas-header-cell-class"
              @selection-change="handleSelectionChange"
            >
              <el-table-column
                type="selection"
                width="155">
              </el-table-column>
              <el-table-column
                prop="name"
                label="姓名"
                width="153"
                align="center"
              >
              </el-table-column>
              <el-table-column prop="sex" label="性别" width="154" align="center">
              </el-table-column>
              <el-table-column
                prop="unit"
                label="单位"
                width="153"
                align="center"
              >
              </el-table-column>
              <el-table-column prop="job" label="职务" align="center">
              </el-table-column>
            </el-table>
          </div>
        </div>
        <span slot="footer" class="dialog-footer" @click="exaTeaok()">
          <button class="green">确 定</button>
        </span>
    </el-dialog>
    <el-dialog title="排考进度" :visible.sync="showYprDialog" class="szjky">
      <div class="spjd" style="width: 95%;margin:100px 0">
        <div class="spjd-title">排考进度：</div>
        <div class="time-line-horizon">
          <div class="time-line-block" v-for="(block, index1) in shspeeds" :key="index1">
            <div class="person-name">{{ block.checkuser }}</div>
            <div class="line-content">
              <img src="../../../assets/assessment/icon-finish.png" alt="已审批" v-if="+block.chstatus === 1"/>
              <img src="../../../assets/assessment/icon-dai.png" alt="待审批" v-if="+block.chstatus === 0"/>
              <img src="../../../assets/assessment/icon-close.png" alt="未审批" v-if="+block.chstatus === -1"/>
              <div class="date-time">
                <span class="date">{{ block.checktime }}</span>
                <span class="time">{{ block.checkdate }}</span>
              </div>
            </div>
            <div class="operate" v-if="index1 == 0 && roleId == '1490859421955674114'">
              <div class="ly-block" @click="buttonClick('留言',block)" style="width: 30px;left: -80px;">
                <img src="../../../assets/assessment/icon-ly.png" alt=""/>
                <div class="ly">留言</div>
              </div>
            </div>
            <div class="operate" v-show="block.checkremark" v-if="roleId == '1490859421955674114'">
              <div class="bubble-block" style="width: 100%">
                <span @click="buttonClick('查看',block)" style=" white-space:nowrap;overflow:hidden;text-overflow:ellipsis;  display: block">{{ block.checkremark }}</span>
                <div class="operate-button">
                  <div
                    class="button-ck"
                    @click="buttonClick('查看',block)"
                    v-show="block.checkremark"
                  >
                    查看
                  </div>
                  <div
                    class="button-bj"
                    @click="buttonClick('编辑',block)"
                    v-show="block.checkremark && index == 1"
                  >
                    编辑
                  </div>
                  <div
                    @click="buttonClick('删除',block)"
                    class="button-sc"
                    v-show="block.checkremark && index == 1"
                  >
                    删除
                  </div>
                </div>
              </div>
            </div>
            <div class="operate" v-show="block.checkremark" v-if="roleId == '1490880658945843202'">
              <div class="bubble-block" style="width: 100%">
                <span @click="buttonClick('查看',block)" style=" white-space:nowrap;overflow:hidden;text-overflow:ellipsis;  display: block">{{ block.checkremark }}</span>
                <div class="operate-button">
                  <div
                    class="button-ck"
                    @click="buttonClick('查看',block)"
                    v-show="block.checkremark"
                  >
                    查看
                  </div>
                  <div
                    class="button-bj"
                    @click="buttonClick('编辑',block)"
                    v-show="block.checkremark && index == 1"
                  >
                    编辑
                  </div>
                  <div
                    @click="buttonClick('删除',block)"
                    class="button-sc"
                    v-show="block.checkremark && index == 1"
                  >
                    删除
                  </div>
                </div>
              </div>
            </div>
            <div class="operate" v-show="block.checkremark" v-if="roleId == '1475294432243830786'">
              <div class="bubble-block" style="width: 100%">
                <span @click="buttonClick('查看',block)" style=" white-space:nowrap;overflow:hidden;text-overflow:ellipsis;  display: block">{{ block.checkremark }}</span>
                <div class="operate-button">
                  <div
                    class="button-ck"
                    @click="buttonClick('查看',block)"
                    v-show="block.checkremark"
                  >
                    查看
                  </div>
                  <!-- <div
                    class="button-bj"
                    @click="buttonClick('编辑',block)"
                    v-show="block.checkremark && index == 0"
                  >
                    编辑
                  </div>
                  <div
                    @click="buttonClick('删除',block)"
                    class="button-sc"
                    v-show="block.checkremark && index == 0"
                  >
                    删除
                  </div> -->
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </el-dialog>
      <!-- 
          :span-method="objectSpanMethod" -->
        <!-- <div class="search-result-desc-panel">
          <span>共找到 {{ searchResultPagin.totalCount }} 条记录，当前显示 {{
          (searchResultPagin.totalCount > 0) ? ((searchResultPagin.currentPage - 1) * searchResultPagin.perpageCount + 1) : (0)
          }} - {{
          (searchResultPagin.totalCount > 0) ? (searchResultPagin.currentPage * searchResultPagin.perpageCount) : (0)
          }} 条记录。</span>
        </div> -->
    <div class="search-result-pagin-panel">
      <el-pagination
        style="marign-top:15px"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="current"
        :page-sizes="[10, 20, 30, 50]"
        :page-size="size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    </div>
    <!-- 添加留言 -->
    <el-dialog
      title="添加留言"
      :visible.sync="showAddMessageDialog"
      width="983px"
    >
      <div class="message-container">
        <div>添加留言：</div>
        <div>
          <el-input
            v-model="message.text"
            type="textarea"
            :rows="8"
            style="width: 550px"
          ></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <button class="green" @click="addText">确 定</button>
      </span>
    </el-dialog>
    <!-- 编辑留言 -->
    <el-dialog
      title="编辑留言"
      :visible.sync="showbjMessageDialog"
      width="983px"
    >
      <div class="message-container">
        <div>编辑留言：</div>
        <div>
          <el-input
            v-model="message.checkremark"
            type="textarea"
            :rows="8"
            style="width: 550px"
          ></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <button class="green" @click="textSelect">确 定</button>
      </span>
    </el-dialog>
    <!-- 查看留言 -->
    <el-dialog
      title="查看留言"
      :visible.sync="showckMessageDialog"
      width="983px"
    >
      <div class="message-container">
        <div>查看留言：</div>
        <div>
          <!--                        v-model="block.bjmeaasgeText"-->
          <el-input
            v-model="message.checkremark"
            type="textarea"
            :rows="8"
            style="width: 550px"
            disabled="false"
          ></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <button class="green" @click="showckMessageDialog = false">确 定</button>
      </span>
    </el-dialog>
    <!-- 教研室主任角色打回 -->
    <el-dialog
      title="打回选择"
      :visible.sync="showExportReportDialog"
      width="983px"
      class="manual-entry-container"
    >
      <div class="message-container">
          <div>打回级别：</div>
          <div>
            <el-select
            v-model="reportTypep"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="(item,index) in reportTypepss"
              :key="index"
              :label="item.value"
              :value="item.label"
            >
            </el-option>
          </el-select>
          </div>
      </div>
      <div class="message-container">
        <div>打回原因：</div>
        <div>
          <el-input
            v-model="rejectLeaving"
            type="textarea"
            :rows="8"
            style="width: 550px"
            placeholder="请输入打回原因"
          ></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <button class="green" @click="sureClick">确 定</button>
      </span>
    </el-dialog> 
    <!-- 申请调整监考 -->
    <el-dialog title="申请调整监考" :visible.sync="applyDialogs" width="983px" style="height:832px" class="szjky">
      <div class="assessment-edit-plan-container">
        <div class="my-form-container" style="width:100%;height:350px" :model="form">
          <el-row class="my-form-item" style="height: 50%;">
            <el-col>
              <div class="my-form-item-label">调整事由</div>
              <div class="my-form-item-value assessment-design">
                <el-input v-model="form.applyreason" type="textarea" :rows="6" style=" width: 625px;
                  margin-top: 17px;  margin-left: -20px;" placeholder="请输入内容"></el-input>
              </div>
            </el-col>
          </el-row>
          <el-row class="my-form-item" style="height: 50%;">
            <el-col>
              <div class="my-form-item-label">新监考员</div>
              <div class="my-form-item-value" style="margin-top:70px; height: 100px;" @click="setTeacher('setNew',newteaexamInfo)">
                <img src="../../../assets/home/grena-anniu.png" alt=""/>
              </div>
              <div style="position: absolute;
                top: 80px;
                left: 52%;">{{form.newteaexam}}</div>
            </el-col>
          </el-row>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
          <img
            @click="saveApply"
            class="del-icon"
            src="../../../assets/home/yellow-commint.png"
            alt=""
          />
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { reqGetXqList,reqCheckYearList,reqZybcList,reqXydList,queryDictByCode } from "@/api/admin1/check";
import {addMessage, updateMessage,alreadyIssue,stayIssue,reject } from "@/api/examination/approvalDelayedExam";
import { getxb,getClass,queryXBclassroom } from "@/api/course/courses";
import { queryExaDetail,selectDetailsJob,getDeptList,updateRemark,updateStatus } from "@/api/courseAchievement/entryResults";
import { editRemark,addApply,courseTeaPlanGetList } from '@/api/courseExame/coursePlan';
import {selectPc} from "../../../api/courseExame/coursePlan";
import { getStore } from '@/util/store.js'
export default {
  data() {
    return {
      checkTypeList: [
        {
          label: "正常",
          value: "正常",
        },
        {
          label: "补考",
          value: "补考",
        },
        {
          label: "第二次补考",
          value: "第二次补考",
        },
        {
          label: "缓考",
          value: "缓考",
        },
        {
          label: "第二次补缓考",
          value: "第二次补缓考",
        }
      ],
      company:'',
      companyList:[],
      courseYpr:'',
      checkedCities:[],
      searchNameList: [],
      rowColumnChecked:false,
      xqList: [],
      xbList:[],
      gClassList:[],
      levelList:[],
      njList: [],
      ddList:[],
      shspeeds:[],
      specialtyList:[],
      sectionList:[], //节次
      statusList: [
        {
          value: "1",
          label: "待排考"
        },
        {
          value: "2",
          label: "待下发核对"
        },
        {
          value: "6",
          label: "待教员审核"
        },
        {
          value: "3",
          label: "待教研主任审核"
        },
        {
          value: "4",
          label: "待发布"
        },
        {
          value: "5",
          label: "已发布"
        }
      ],
      queryParamsForm: {
        xueqi:'',
        exadate:'',
        exaschedule:'',
        teachingandresearchsection:'',
        department:'',
        teachingfaculty:'',
        coursename:'',
        studentteam:'',
        studentlevel:'',
        className:'',
        biggernumber:0,
        examcoucheckstatus: '',
        remark:'',
        checkType:'',
        planname:'',
      },
      exaStatus:'',
      tableData: [],
      current:1,
      size:10,
      kpId:this.$route.query.id,
      total:'',
      code:'section',
      pos:0,
      spanArr:[],
      roleIndex:'',
      showYprDialog:false,
      showJKYDialog:false,
      //添加留言
      showAddMessageDialog: false,
      //编辑留言
      showbjMessageDialog: false,
      //查看留言
      showckMessageDialog: false,
      //教研室主任打回
      showExportReportDialog:false,
      applyDialogs:false,
      form: {
        examcouid: "",
        applyreason: "",
        newteaexam: ""
      },
      reportTypep: "",
      reportTypepss: [
        {
          value: "管理员",
          label: "管理员",
        },
      ],
      rejectLeaving: '',
      message: {
        text: ''
      },
      yprList:[],
      exaterList:[],
      lssueSelection:[],
      ids:'',
      setTeacherInfo:{},
      roleId: '',
      newteaexamInfo:{},
      teaSaveType:'',
      exateridList:[],
      isCanIssue:'true',
      selectPcList:[],
      newStatus:[],
    };
  },
  created() {
    const userInfo = getStore({
      name: "userInfo",
      debug: true,
    }) || {}
    this.roleId = userInfo.content.role_id;
    console.log(this.roleId)
  },
  computed: {
    config() {
      return {
        mergeTarget: "courseid", // 通用依据
        combineProp: [
          // combineProp - 根据mergeTarge 进行合并的单元格属性
          "checkBoxAll",
          "examcoucheckstatus",
          "exadate",
          "exaschedule",
          "department",
          "teachingandresearchsection",
          "coursename",
          "teachingfaculty",
          "finalexamination",
          "checktype",
          "situdemand",
        ],
      };
    },
    // ...mapGetters(['userInfo']),
  },
  watch: {
    // rowColumnChecked: {
    //   deep: true,
    //   handler() {
    //     this.tableData = this.tableData.map((item) => {
    //       return {...item, rowChecked: this.rowColumnChecked};
    //     });
    //   }
    // },
  },
  mounted(){
    this.termAll();
    this.xbAll();
    this.sectionData();
    this.classAll();
    this.gradeAll();
    this.ddAll();
    this.getlist();
    getDeptList().then(res=>{
      if(res.data.code == 200){
        this.companyList = res.data.data;
      }
    })
    selectPc().then(res=>{
      this.selectPcList = res.data.data;
    })
    this.queryExaDetail("");
    // this.getSpanArr()
  },
  methods: {
    // 备注失去焦点时触发
    async saveRemarks(row) {
      const obj = {
        id: row.remarkId,
        remark: row.remark,
      };
      const result = await updateRemark(obj);
      if (result.data.code == 200) {
        return "ok";
      }
      // updateRemark(obj).then(res=>{
      //   if (res.data.code == 200) {
      //     this.queryExaDetail();
      //     return "ok";
      //   }
      // });
    },
    //申请调整监考
    applyChange(row){
      this.form.applyreason = ''
      this.form.examcouid = row.id;
      this.newteaexamInfo = row;
      this.form.newteaexam = row.exatername;
      this.applyDialogs = true;
    },
    //保存调整申请
    saveApply() {
      if(this.form.applyreason == '' || this.form.newteaexam == ''){
        this.$message({
          type:'error',
          message:'两者不能有空值！'
        })
        return
      }
      addApply(this.form).then(res => {
        if(res.data.code == 200){
          this.$message({
            type: 'success',
            message: '申请成功'
          });
          this.applyDialogs = false;
          this.queryExaDetail();
        }
      })
    },
    //打回弹框
    levelUpdate(rows){
      this.reportTypep = '';
      this.rejectLeaving = '';
      this.idType = rows.id;
      this.shspeeds = rows.shspeeds;
      this.showExportReportDialog = true
      // this.rejectUpdat(rows)
    },
    //打回级别
    // rejectUpdat(rows) {
    //   let shspeeds = rows.shspeeds;
    //   let arr = [];
    //   let obj;
    //   let sort = '';
    //   for (const shspeedsKey in shspeeds) {
    //     console.log(this.roleId)
    //     console.log(shspeeds[shspeedsKey].roleId)
    //     if(shspeeds[shspeedsKey].roleId == this.roleId){
    //       sort = shspeeds[shspeedsKey].sort;
    //       this.idType = shspeeds[shspeedsKey].id
    //     }
    //     if (+shspeeds[shspeedsKey].chstatus == 1) {
    //       console.log(shspeeds[shspeedsKey])
    //       // console.log(shspeeds[shspeedsKey])
    //       let checkuser = shspeeds[shspeedsKey].checkuser.split(':')[0];
    //       console.log(checkuser)
    //       obj = {
    //         label: shspeeds[shspeedsKey].sort,
    //         value: checkuser,
    //         id: shspeeds[shspeedsKey].did
    //       }
    //       arr.push(obj)
    //     }
    //     this.reportTypepss = arr
    //   }
    //   console.log(this.reportTypepss)
    //   this.reportTypepss = this.reportTypepss.filter((k)=>{
    //     return k.label < sort
    //   })
    // },
    //打回提交
    sureClick() {
      let obj = {};
      obj.did = this.idType;
      obj.isHK = false;
      obj.id = this.shspeeds[1].id;
      if (this.reportTypep != '') {
        obj.reject = '0';
        obj.sort = 1;
      } else {
        this.$message.error('没有选择打回人');
        return
      }
      if (this.rejectLeaving != '') {
        obj.leaving = this.rejectLeaving
      } else {
        this.$message.error('没有输入打回原因');
        return
      }
      this.showExportReportDialog = false;
      return new Promise(() => {
        //打回保存
        reject(obj).then(res => {
          if (res.data.code === 200) {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "success",
            });
            this.queryExaDetail();
          }
        })
      })
    },
    //查看全部考试安排
    toLinkAll(){
      this.$router.push({
          path: "/student/examination/examinationlist"
      });
    },
    //查看全部补缓考安排
    toLinkAllT(){
      this.$router.push({
          path: "/teacher/workload/arrangement"
      });
    },
    handleSelectionChange(val){
      this.multipleSelection = val;
      this.searchNameList = val;
      // this.multipleSelection.splice(0, this.multipleSelection.length);
      // this.searchNameList.splice(0, this.searchNameList.length);
      // for (const valKey in val) {
      //   this.searchNameList[valKey] = val[valKey].name
      // }
      // console.log(this.searchNameList)
    },
    //监考员弹框内查询
    searchTeacher(){
      let teacherInfo = {
        bzbm:this.company,
        xm:this.courseYpr
      };
      selectDetailsJob(teacherInfo).then(res=>{
        if(res.data.code == 200){
          this.yprList = res.data.data;
          // this.searchNameList = res.data.data;
          // if(typeof this.setTeacherInfo.exaterid && this.setTeacherInfo.exaterid == 'string'){
          //   this.$nextTick(() => {
          //     this.$refs.multipleTableExter.toggleRowSelection(
          //       this.yprList.find(item => {
          //           return this.setTeacherInfo.exaterid == item.id;
          //         }
          //       ), true);
          //   })
          // } else if(this.setTeacherInfo.exaterid && this.setTeacherInfo.exaterid.length > 0){
          //   this.$nextTick(() => {
          //     this.setTeacherInfo.exaterid.forEach(res => {
          //       this.$refs.multipleTableExter.toggleRowSelection(
          //         this.yprList.find(item => {
          //             return res == item.id;
          //           }
          //         ), true);
          //     })
          //   })
          // }
        }
      })
      // this.setTeacher(this.setTeacherInfo)
    },
    //点击设置监考员
    setTeacher(type,row){
      this.teaSaveType = type;
      let obj = {};
      this.setTeacherInfo = row;
      this.setexaterId = row.id;
      this.showJKYDialog = true;
      // this.multipleSelection.splice(0, this.multipleSelection.length);
      // this.searchNameList.splice(0, this.searchNameList.length);
      return new Promise(() => {
        selectDetailsJob(obj).then(res => {
          this.yprList = res.data.data;
          if(row.exaterid && typeof row.exaterid == 'string'){
            this.$nextTick(() => {
            this.$refs.multipleTableExter.clearSelection()
              this.$refs.multipleTableExter.toggleRowSelection(
                this.yprList.find(item => {
                  console.log(item)
                    return row.exaterid == item.id;
                  }
                ), true);
            })
          } else if(row.exaterid && row.exaterid.length > 0){
            this.$nextTick(() => {
              this.$refs.multipleTableExter.clearSelection()
              row.exaterid.forEach(res => {
                this.$refs.multipleTableExter.toggleRowSelection(
                  this.yprList.find(item => {
                      return res == item.id;
                    }
                  ), true);
              })
            })
          }
        })
      })
    },
    delTag(index) {
      let el = this
      this.searchNameList.splice(index, 1);
      el.$nextTick(() => {
        el.$refs.multipleTableExter.toggleRowSelection(
          el.yprList.find(item => {
              return this.multipleSelection[index].id == item.id;
            }
          ), false);
      })
    },
    //选择监考员点击确定
    exaTeaok(){
      let arr = [];
      let nameArr = [];
      if(this.multipleSelection.length > 0){
        if(typeof this.multipleSelection[0] == 'undefined'){
          var newArr = this.multipleSelection.slice(0);
          newArr.shift();
          this.multipleSelection = newArr
        }
        for (const Key in this.multipleSelection) {
          arr[Key] = this.multipleSelection[Key].id;
          nameArr[Key] = this.multipleSelection[Key].name; 
        }
      }
      let obj = {
        id:this.setexaterId,
        exaterid:arr.join(","),
        exatername:nameArr.join(",")
      }
      if(this.teaSaveType == 'setNew'){
        this.form.newteaexam = nameArr.length > 0 ? nameArr.join(",") : '';
        this.showJKYDialog = false;
        this.applyDialogs = true;
      } else {
        editRemark(obj).then(res=>{
          if(res.data.code == 200){
            this.showJKYDialog = false;
            this.$message({
              showClose: true,
              message: '操作成功！',
              type: 'success'
            });
            this.queryExaDetail();
          }
        })
      }
    },
    selectCheck() {
      console.log(val)
      // let arr = [];
      // let isflag = this["rowColumnChecked"]
      // for (const arrKey in arr) {
      //   this[arr[arrKey] + "ColumnChecked"] = isflag
      //   this.tableData = this.tableData.map((item) => {
      //     return {
      //       ...item,
      //       [arr[arrKey] + "Checked"]: this[arr[arrKey] + "ColumnChecked"],
      //     };
      //   });
      // }
      // this.tableData = this.tableData.map((item) => {
      //   return {...item, rowChecked: this.rowColumnChecked};
      // });
    },
    //点击首页查看排考进度
    lookSpeeds(row){
      this.showYprDialog = true;
      //排考进度
      if(row.shspeeds.length > 0) {
        for (let x = 0; x < row.shspeeds.length; x++) {
          this.shspeeds[x] = {
            checktime: row.shspeeds[x].audittime != "" ? row.shspeeds[x].audittime.split('T')[0] : "",
            chenckdate: row.shspeeds[x].audittime != "" ? row.shspeeds[x].audittime.split('T')[1] : "",
            id: row.shspeeds[x].id,
            checkremark: row.shspeeds[x].leaving,
            checkuser: row.shspeeds[x].reviewer,
            chstatus: row.shspeeds[x].status,
            did:row.shspeeds[x].did,
            sort:row.shspeeds[x].sort,
            roleId:row.shspeeds[x].roleId
          }
        }
      }
      console.log(this.shspeeds)
    },
    //进度内的按钮点击
    buttonClick(type, black) {
      console.log(black)
      this.message = {}
      // if(this.roleId == '1490880658945843202'){
      //   if(this.delCurrentState != '1' && type != "查看"){
      //     this.$message("不可操作留言！");
      //     return
      //   }
      // } else if(this.roleId == '1490859421955674114'){
      //   if(this.delCurrentState != '2' && type != "查看"){
      //     this.$message("不可操作留言！");
      //     return
      //   }
      // }
      console.log(black, 'black')
      this.message = {
        id: black.id,
        checkremark: black.checkremark
      }
      if (type === '留言') {
        this.showAddMessageDialog = true
        console.log(this.message)
      } else if (type === '查看') {
        this.showckMessageDialog = true,
          console.log(this.message)
      } else if (type === '编辑') {
        this.showbjMessageDialog = true
        console.log(this.message)
      } else if (type === '删除') {
        this.$confirm('确认要删除吗？')
          .then(_ => {
            this.textDelete()
          })
      }
    },
    //添加留言
    addText() {
      // this.showAddMessageDialog = false;
      // this.update(tid, tex);
      let obj = {
        id: this.message.id,
        leaving: this.message.text
      }
      addMessage(obj).then(res => {
        if (res.status == 200) {
          this.showAddMessageDialog = false;
          this.showYprDialog = false;
          this.$message({
            showClose: true,
            message: '添加成功',
            type: 'success'
          });
          this.queryExaDetail()
        }
      })
    },
    //编辑留言
    textSelect() {
      let obj = {
        id: this.message.id,
        leaving: this.message.checkremark
      }
      updateMessage(obj).then(res => {
        if (res.status == 200) {
          this.showbjMessageDialog = false;
          this.showYprDialog = false;
          this.$message({
            showClose: true,
            message: '编辑成功',
            type: 'success'
          });
          this.queryExaDetail()
        }
      })
    },
    //删除留言
    textDelete() {
      let obj = {
        id: this.message.id,
        leaving: "",
      }
      updateMessage(obj).then(res => {
        if (res.status == 200) {
          this.showYprDialog = false;
          this.$message({
            showClose: true,
            message: '删除成功',
            type: 'success'
          });
          this.queryExaDetail()
        }
      })

    },
    //操作列发布按钮
    release(ids){
      this.releaseData(ids)
    },
    //外部表格批量操作表格
    handleSelectionlssue(val){
      this.lssueSelection = val;
      let newArr = [];
      let newStatus = [];
      val.forEach((element) => {
        newArr.push(element.courseid);
        newStatus.push(element.examcoucheckstatus);
        newArr = [...new Set(newArr)]
      });
      this.newStatus = newStatus;
      this.idaS = newArr.join(",");
    },
    //批量发布
    issueBatch(){
      if(this.lssueSelection.length <= 0){
        this.$message({ type: "error", message: '请先选择需要发布的数据！' });
        return
      } else if (this.newStatus.includes("5")) {
          this.$message.error("存在已经为发布状态的数据！");
          return
      } else {
        this.releaseData(this.idaS);
      }
    },
    releaseData(ids){
      alreadyIssue(ids).then(res=>{
        if(res.data.code == 200){
          this.$message({
            showClose: true,
            message: '操作成功！',
            type: "success",
          });
          this.queryExaDetail();
        } else {
          this.$message({
            showClose: true,
            message: res.data.msg,
            type: "error",
          });
        }
      })
    },
    //操作列取消发布
    stayIssueOne(ids){
      this.stayIssueData(ids)
    },
    //批量取消发布
    stayIssueBatch(){
      if(this.lssueSelection.length <= 0){
        this.$message({ type: "error", message: '请先选择需要取消发布的数据！' });
        return
      } else if(this.newStatus.includes("4")){
        this.$message.error("存在还未发布的数据！");
        return
      } else {
        this.stayIssueData(this.idaS);
      }
    },
    stayIssueData(ids){
      stayIssue(ids).then(res=>{
        if(res.data.code == 200){
          this.$message({
            showClose: true,
            message: '操作成功！',
            type: "success",
          });
          this.queryExaDetail();
        } else {
          this.$message({
            showClose: true,
            message: res.data.msg,
            type: "error",
          });
        }
      })
    },
    //考试数据统计
    statistical(){
      this.$router.push({
          path: "/admin/examination/statistical"
      });
    },
    //调整监考申请记录
    adjustInVi(){
      this.$router.push({
          path: "/teacher/workload/AdjustInvigilators"
      });
    },
    //安排考试
    arrangeExam(id){
      this.$router.push({
          // path: "/director/examination/arrangeTest"
          path: "/admin/examination/arrangeTest",
          query:{id}
      });
    },
    //节次
    sectionData() {
      queryDictByCode(this.code).then(res=>{
        this.sectionList = res.data.data;
      })
    },
    //获取专业班次
    async getlist(){
      const result = await reqZybcList();
      result.data.code == 200 ? this.specialtyList = result.data.data : [];
    }, 
    // 获取队别下拉框
    async ddAll(){
      const result = await reqXydList();
      result.data.code == 200 ? this.ddList = result.data.data : [];
    },
    // 获取学期
    async termAll() {
      const result = await reqGetXqList();
      if (result.data.code == 200) {
        this.xqList = result.data.data;
      }
    },
    async xbAll(){
      const xb = await getxb();
      xb.data.code == 200 ? this.xbList = xb.data.data : [];
    },
    async classAll(){
      const gClass = await getClass();
      gClass.data.code == 200 ? this.gClassList = gClass.data.data : [];
    },
    // 根据系部选中获取教研室
    async handleXb(val){
      if(val){
        const xbClass = await queryXBclassroom(val);
        xbClass.data.code == 200 ? this.gClassList = xbClass.data.data : [];
        this.queryParamsForm.teachingandresearchsection = ''
      } else {
        this.xbAll();
        this.classAll();
      }
    },
    // 教研室下拉框的改变
    handleClass(val){
      if(!val){
        this.xb ? this.handleXb(this.xb)  : this.classAll();
      }
    },
    //获取年级
    gradeAll(){
      let that = this;
      reqCheckYearList().then(res => {
        if(res.data.code == 200 && res.data.data){
          that.njList = res.data.data;
        }
      });
    },
    //是否可以点击下发核对
    isCanIssuePlan(){
      if(this.lssueSelection.length <= 0){
        this.$message({
          showClose: true,
          message: '请选择需要下发核对的数据！',
          type: "error",
        });
      } else {
        updateStatus(this.idaS).then(res=>{
          if(res.data.code == 200){
            // /shspeed/coursePass
            this.$message({
              showClose: true,
              message: '操作成功！',
              type: "success",
            });
            this.queryExaDetail()
          }
        })
      }
    },
    //表格数据
    queryExaDetail(exaStatus){
      this.queryParamsForm.examcoucheckstatus = exaStatus;
      queryExaDetail(this.current,this.size,this.kpId,this.queryParamsForm).then(res=>{
        if(res.data.code == 200){
          let newArr = [];
          // this.tableData = res.data.data.records;
          this.total = res.data.data.total;
          if(res.data.data.records.length > 0){
            for (let i = 0; i < res.data.data.records.length; i++) {
              for (let j = 0; j < res.data.data.records[i].examplancalssList.length; j++) {
                // let arr = res.data.data.records[i].examplancalssList;
                res.data.data.records[i].examplancalssList[j].studentTeam = res.data.data.records[i].examplancalssList[j].specialtyClassInfo.studenteamname;
                res.data.data.records[i].examplancalssList[j].studentlevel = res.data.data.records[i].examplancalssList[j].specialtyClassInfo.year;
                res.data.data.records[i].examplancalssList[j].className = res.data.data.records[i].examplancalssList[j].specialtyClassInfo.className;
                res.data.data.records[i].examplancalssList[j].biggernumber = res.data.data.records[i].examplancalssList[j].specialtyClassInfo.ratedNumber;
                res.data.data.records[i].examplancalssList[j].remark = res.data.data.records[i].examplancalssList[j].specialtyClassInfo.remark;
                res.data.data.records[i].examplancalssList[j].remarkId = res.data.data.records[i].examplancalssList[j].specialtyClassInfo.id;
                if(res.data.data.records[i].examplancalssList[j].exaterid.indexOf(',') != -1){
                  res.data.data.records[i].examplancalssList[j].exaterid = res.data.data.records[i].examplancalssList[j].exaterid.split(',');
                } else {
                  let arrif = [];
                  arrif.push(res.data.data.records[i].examplancalssList[j].exaterid);
                  res.data.data.records[i].examplancalssList[j].exaterid = arrif[0];
                }
                if(res.data.data.records[i].examplancalssList[j].exatername.indexOf(',') != -1){
                  res.data.data.records[i].examplancalssList[j].exatername = res.data.data.records[i].examplancalssList[j].exatername.split(',');
                } else {
                  let arrif = [];
                  arrif.push(res.data.data.records[i].examplancalssList[j].exatername);
                  res.data.data.records[i].examplancalssList[j].exatername = arrif[0];
                }
                
                res.data.data.records[i].examplancalssList[j].shspeeds = res.data.data.records[i].shspeeds;
                res.data.data.records[i].examplancalssList[j].exadate = res.data.data.records[i].exadate.substring(0,10);
                res.data.data.records[i].examplancalssList[j].exaschedule = res.data.data.records[i].exaschedule;
                res.data.data.records[i].examplancalssList[j].examcoucheckstatus = res.data.data.records[i].examcoucheckstatus;
                res.data.data.records[i].examplancalssList[j].department = res.data.data.records[i].courseimplementplan.department;
                res.data.data.records[i].examplancalssList[j].teachingandresearchsection = res.data.data.records[i].courseimplementplan.teachingandresearchsection;
                res.data.data.records[i].examplancalssList[j].checktype = res.data.data.records[i].examplan.checktype;
                res.data.data.records[i].examplancalssList[j].coursename = res.data.data.records[i].courseimplementplan.coursename;
                res.data.data.records[i].examplancalssList[j].teachingfaculty = res.data.data.records[i].courseimplementplan.teachingfaculty;
                res.data.data.records[i].examplancalssList[j].finalexamination = res.data.data.records[i].courseimplementplan.finalexamination;
                res.data.data.records[i].examplancalssList[j].situdemand = res.data.data.records[i].courseimplementplan.situdemand;
                // const i = res.data.data.records[i].examplancalssList.find(_item => item.siteid === _item.siteid);
                // if(i !== item) {
                //   i.specialtyClassInfo.className.push(i.specialtyClassInfo.className);
                //   i.specialtyClassInfo.id.push(i.specialtyClassInfo.id);
                // } else {
                //     i.specialtyClassInfo.className = [i.specialtyClassInfo.className];
                //     i.specialtyClassInfo.id = [i.specialtyClassInfo.id];
                // }
                // let resultList = [];
                // for(let k=0; k < res.data.data.records[i].examplancalssList[j].specialtyClassInfo.id.length; k++){
                //   let obj = {};
                //   obj.id = res.data.data.records[i].examplancalssList[j].specialtyClassInfo.id[k];
                //   obj.name = res.data.data.records[i].examplancalssList[j].specialtyClassInfo.className[k];
                //   resultList.push(obj);
                // }
                // res.data.data.records[i].examplancalssList[j].className = resultList;
              }
              // console.log(res.data.data.records[i].examplancalssList[j])
              // newArr[i].className = resultList;
              newArr = newArr.concat(res.data.data.records[i].examplancalssList)
            }
            this.tableData = newArr;
            this.mergeRow();

          }
        }
      })
    },
    //查询
    onSearchClickHandler() {
      if(this.exaStatus.length == 0){
        this.queryParamsForm.examcoucheckstatus = '';
      } else {
        this.queryParamsForm.examcoucheckstatus = this.exaStatus.toString();
      }
      this.queryExaDetail(this.queryParamsForm.examcoucheckstatus)
    },
    handleCurrentChange(val) {
      this.current = val;
      this.queryExaDetail();
    },
    handleSizeChange(val) {
      this.size = val;
      this.queryExaDetail();
    },
    //表格做合并
    arraySpanMethod({ row, column }) {
      const span = column["property"] + "-span";
      if (row[span]) {
        return row[span];
      }
    },
    mergeRow() {
      let newArr = [].concat(this.tableData);
      // arr.splice(index, 0, Object.assign({}, row))
      this.tableData = this.mergeData(newArr);
    },
    mergeData(list) {
      // mergeTarge - 合并项依据
      // combineProp - 根据mergeTarge 进行合并的单元格属性
      return this.filterData(this.config, [].concat(list));
    },
    isObject(val) {
      return Object.prototype.toString.call(val) === "[object Object]";
    },
    isEmpty(val) {
      return typeof val == "undefined" || val === null || val == "-";
    },
    filterData(config, tableData, targetProp) {
      const { mergeTarget, combineProp } = config;
      // 叠加的合并条件
      combineProp.forEach((column) => {
        // 记录合并项
        let combineCount = 1;
        if (this.isObject(column)) {
          return this.filterData.call(this, column, tableData, mergeTarget);
        }
        // 使用倒序遍历
        for (let i = tableData.length - 1; i >= 0; i--) {
          let curr = tableData[i],
            prev = tableData[i - 1];

          if (this.isEmpty(prev)) {
            // 已经循环完毕
            curr[`${column}-span`] = {
              rowspan: combineCount,
              colspan: combineCount >= 1 ? 1 : 0,
            };
            break;
          }

          if (
            prev[targetProp] === curr[targetProp] &&
            prev[mergeTarget] === curr[mergeTarget] &&
            prev[`${column}`] === curr[`${column}`]
          ) {
            ++combineCount;
            curr[`${column}-span`] = {
              rowspan: 0,
              colspan: 0,
            };
          } else {
            curr[`${column}-span`] = {
              rowspan: combineCount,
              colspan: combineCount >= 1 ? 1 : 0,
            };
            prev[`${column}-span`] = {
              rowspan: 1,
              colspan: 1,
            };
            // 前后项不相符时，对combinecount进行重置
            combineCount = 1;
          }
        }
      });
      return tableData;
    },
  }
};
</script>

<style lang="less" scoped>
.button-list {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        margin-left: 21px;

        .button-item {
          display: flex;
          flex-direction: row;
          align-items: center;
          justify-content: center;
          position: relative;
          width: 69px;
          height: 27px;
          line-height: 27px;
          border: 1px solid #004ca7;
          border-radius: 4px;
          margin-right: 10px;
          text-align: center;
          font-size: 14px;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: #004ca7;

          .del-icon {
            position: absolute;
            right: 0px;
            top: 0px;
            width: 12px;
            height: 12px;
            padding: 2px;
          }
        }
      }
/deep/.detail-input .el-textarea__inner {
  border: 0 none;
}
/deep/.el-checkbox-button, .el-checkbox-button__inner {
  width: 75px;
  border: 1px solid #DCDFE6;
  border-radius: 4px;
  margin-bottom: 10px;
  height: 37px;
}
.spjd
.time-line-horizon
.time-line-block {
  width: 297px !important;
}
.spjd {
  .spjd-title {
    margin: 10px 0 0 18px;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #004ca7;
  }

  .time-line-horizon {
    position: relative;
    margin-left: 129px;
    margin-top: -15px;
    display: flex;
    flex-direction: row;

    .time-line-block {
      display: flex;
      flex-direction: column;
      width: 225px;

      &::before {
        content: "";
        position: absolute;
        top: 35px;
        width: 270px;
        border-bottom: 2px dashed #4b78ac;
      }

      &:last-child {
        width: 190px;
        &::before {
          content: "";
          position: absolute;
          top: 35px;
          width: 572px;
          border-bottom: 0px dashed #4b78ac;
        }
      }

      .person-name {
        font-size: 14px;
        height: 15px;
        line-height: 15px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #004ca7;
        width: 50%;
        position: relative;
        left: -20%;
        text-align: center;
      }

      .line-content {
        display: flex;
        flex-direction: row;
        align-items: center;
        height: 40px;
        z-index: 100;

        > img {
          width: 26px;
          height: 26px;
        }

        .date-time {
          display: flex;
          flex-direction: column;
          font-size: 12px;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: #004ca7;

          .date,
          .time {
            margin: 3px 8px;
          }
        }
      }

      .operate {
        margin-top: 10px;
        position: relative;

        .ly-block {
          cursor: pointer;
          display: flex;
          flex-direction: column;
          align-items: center;
          position: relative;
          left: -8px;
          width: 40px;

          > img {
            width: 33px;
            height: 33px;
          }

          .ly {
            font-size: 14px;
            font-family: Microsoft YaHei;
            font-weight: 400;
            color: #f1b107;
          }
        }

        .bubble-block {
          cursor: pointer;
          left: -50px;
          width: 280px;
          height: 60px;
          background: url(../../../assets/assessment/bubble.png) center no-repeat;
          background-size: 100%;
          position: relative;
          padding: 15px 10px 5px;
          box-sizing: border-box;

          > span {
            font-size: 14px;
            font-family: Microsoft YaHei;
            font-weight: 400;
            line-height: 20px;
            color: #004ca7;
          }

          .operate-button {
            position: absolute;
            bottom: 8px;
            right: 10px;
            display: flex;
            flex-direction: row;
            align-items: center;
            padding: 0 3px;

            > div {
              width: 37px;
              box-sizing: border-box;
              background: #fff6dc;
              border: 1px solid #f1b107;
              border-radius: 4px;
              margin-left: 6px;
              font-size: 12px;
              font-family: Microsoft YaHei;
              font-weight: 400;
              color: #f1b107;
              text-align: center;
            }

            .button-ck {
              background: #fff6dc;
              border: 1px solid #f1b107;
              color: #f1b107;
            }

            .button-bj {
              background: #ffefef;
              border: 1px solid #fa5339;
              color: #fa5339;
            }

            .button-sc {
              background: #f1f8fe;
              border: 1px solid #51aef6;
              color: #51aef6;
            }
          }
        }
      }
    }
  }
}
.bk-lucj-expot-button {
  cursor: pointer;
  width: 95px;
  background: #fef1e8;
  border: 1px solid #f86900;
  box-sizing: border-box;
  margin: 0 auto 12px;
  border-radius: 6px;
  img{
    width: 13px;
    height: 13px;
    position: relative;
    top: 1px;
  }
  &:last-child {
    margin-bottom: 0px;
  }
  > span {
    color: #f86900;
    margin-left: 5px;
  }
}
/deep/.el-select__tags{
  min-width: 151px;
}
/deep/.el-date-editor .el-input__prefix{
  left: auto;
  top: 2px;
  right: 5px;
}
/deep/.el-input--mini .el-input__icon{
  line-height: 40px;
}
.search-button {
  cursor: pointer;
  box-sizing: border-box;
  justify-content: center;
  width: 70px;
  height: 27px;
  line-height: 25px;
  background: #f1f8fe;
  border: 1px solid #51aef6;
  border-radius: 6px;
  font-size: 14px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  display: inline-block;
  > img {
    width: 19px;
    height: 19px;
    margin-right: 4px;
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/delayedExam.less";
.message-container {
  margin-top: 30px;
  > div {
    display: inline-block;

    &:nth-child(1) {
      padding-left: 111px;
      font-size: 20px;
      color: rgba(0, 76, 167, 1);
      font-weight: bold;
      vertical-align: top;
    }

    &:nth-child(2) {
    }
  }
}
// /deep/.assessment-container .table-container .table-body .item {
//     overflow: hidden;
//     text-overflow: ellipsis;
//     display: flex;
//     align-items: center;
//     justify-content: center;
// }
@fontFamily:"Microsoft YaHei";

.search-result-pagin-panel {
  text-align:right;
}
.el-pagination {
  color: red;
  ::v-deep > .el-pagination__total {
    color: #004ca7;
  }
}
.search-result-desc-panel {
  font-size: 14px;
  font-weidth: normal;
  font-family: @fontFamily;
  color: #004ca7;
  margin: 15px 0 0 0;
}
@fontFamily:"Microsoft YaHei";
.xpaas-table-class {
  border: 1px solid #004ca7;
  border-radius: 9px;
  margin: 15px 0;
  > ::v-deep div.el-table__header-wrapper {
    > table.el-table__header {
      > thead {
        > tr.xpaas-header-row-class {
          padding: 0;
          height: 76px;
          background-color: #edf2f9;
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          > th.xpaas-header-cell-class {
            font-weight: bold;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
  > ::v-deep div.el-table__body-wrapper {
    > table.el-table__body {
      > tbody {
        > tr.xpaas-row-class {
          > td.xpaas-header-cell-class {
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
          > td.xpaas-cell-class {
            height: 76px;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            > div.cell {
              font-weight: normal;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
}



/* 声明常量 */
@formItemMargin:0px;

.xpaas-form-item-6 {
  > ::v-deep .el-form-item__label {
    color: #004ca7;
    font-size: 16px;
    // font-weight: bold;
    font-family: @fontFamily;
    width: 140px;
  }
  > ::v-deep .el-form-item__content {
    padding: 0 @formItemMargin;
    // margin-left: 15px;
    > .el-select {
      width: 100%;
      ::v-deep .el-input__inner {
        width: 100%;
      }
    }
  }
}
.el-form-item {
  margin-right: 42px;
  display: inline-block;
  > ::v-deep .el-form-item__label {
    color: #004ca7;
    font-size: 16px;
    // font-weight: bold;
    font-family: @fontFamily;
  }
  > ::v-deep .el-form-item__content {
    display: inline-block;
    padding: 0 @formItemMargin;
    > .el-select {
      width: 100%;
      ::v-deep .el-input__inner {
        width: 100%;
      }
    }
  }
}
</style>